package MemberAction;

import java.io.IOException;
import java.io.PrintWriter;
import java.io.UnsupportedEncodingException;

import javax.servlet.RequestDispatcher;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import DAO.MemberDAO;
import DTO.MemberBean;

public class MemberFindAction implements MemAction {

	@Override
	public void execute(HttpServletRequest request, HttpServletResponse response) {
		try {
			request.setCharacterEncoding("euc-kr");
			String name = request.getParameter("name");
			String jumin1 = request.getParameter("jumin1");
			String jumin2 = request.getParameter("jumin2");
			MemberDAO dao = new MemberDAO();
			MemberBean bean = dao.idpwFind(name, jumin1, jumin2);
			PrintWriter out = null;
			String page="";
			if(bean.getMember_id()!=null){
				request.setAttribute("bean", bean);
				page="./member/member_find_ok.jsp";
			}else {
				page = "./member/member_find_not.jsp";
			}
			RequestDispatcher dis = request.getRequestDispatcher(page);
			dis.forward(request, response);
		}catch (Exception e) {
			e.printStackTrace();
		}
	}

}
